/**
 * @Author Mrlu
 * @Version 1.0
 * @Date 2023-08-15 16:41:01
 */
package com.cl.erp_2301.controller;

import com.cl.erp_2301.Service.OrdersService;
import com.cl.erp_2301.dto.DataDTO;
import com.cl.erp_2301.dto.OrdersDTO;
import com.cl.erp_2301.util.Result;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class OrderdetailController {

    @Resource
    private OrdersService ordersService;
    /*统计表*/
    @GetMapping("/start/json/echarts/sxt.json")
    public Result patterns(int page,int rows){
        Page<Object> page1= PageHelper.startPage(page,rows);
        List<OrdersDTO> ordersStoreDTOList=ordersService.patterns();
        DataDTO dateDTO=new DataDTO<>();
        dateDTO.setRows(ordersStoreDTOList);
        dateDTO.setTotal(page1.getTotal());
        return Result.ok(dateDTO);
    }
    @GetMapping("/start/json/echarts/zxt.json")
    public Result charkmap(int page,int rows){
        Page<Object> page1=PageHelper.startPage(page, rows);
        List<OrdersDTO> ordersStoreDTOList=ordersService.charkmap();
        DataDTO dataDTO=new DataDTO<>();
        dataDTO.setRows(ordersStoreDTOList);
        dataDTO.setTotal(page1.getTotal());
        return Result.ok(dataDTO);
    }

}
